﻿<{include file="header.htm"}>
<link href="<{$config.weburl}>/templates/default/css/booking.css" rel="stylesheet" media="screen" type="text/css" />
<script src="<{$config.weburl}>/templates/default/js/layer/layer.min.js"></script>
<script language="javascript" type="text/javascript" src="<{$config.weburl}>/templates/default/js/jquery.validate.js"></script>
        <div class="width_1210">
            <div class="top_first"> </div>
            <!--订单页面-->
            <div class="order_con" >
                <form id="order_form" action="<{$config.weburl}>/?m=product&s=shop_stock" method="post" onsubmit=" return check_data();">
                    <input type="hidden" name="act" value="stock"/>
                    <input type="hidden" name="product_id" value="<{$de.id}>" />
                    <div class="order_left">
                        <div class="order_data_con">
                            <div class="yd_msg">
                                <h3>登记信息<span></span></h3>
                                <div class="msg_con">

                                    <dl>
                                        <dt>票品名称：</dt>
                                        <dd><input type="text" name="product_name" readonly class="msg_text" style=" width: 500px;"  value="<{$de.pname}>" /></dd>
                                    </dl>

                                    <dl>
                                        <dt>票品价格：</dt>
                                        <dd><input type="text" name="price" id="price" class="msg_text" value="<{$de.price}>" /><span>￥</span></dd>
                                    </dl>

                                    <dl>
                                        <dt>票品数量：</dt>
                                        <dd><input type="text" name="num" id="num" class="msg_text" value="1" /><span>张</span></dd>
                                    </dl>

                                    <dl>
                                        <dt>联系人：</dt>
                                        <dd><input type="text" name="user_name" id="user_name" class="msg_text" value="" /><span>（*此处可输入姓名)</span></dd>
                                    </dl>
                                    <dl>
                                        <dt>联系手机：</dt>
                                        <dd><input type="text" class="msg_text" name="user_mobile" id="user_mobile" value="" /><span>（*此处可输入手机号码)</span></dd>
                                    </dl>

                                    <dl>
                                        <dt>省市区：</dt>
                                        <dd>
                                            <select name="provinceid" id="provinceid"  class="msg_text" style="margin-right: 5px;">
                                                <option value="">请选择</option>
                                                <{foreach item=vo from=$prov}>
                                                <option value="<{$vo.id}>" <{if $vo.id == $consignee.provinceid}> selected <{/if}> ><{$vo.name}></option>
                                                <{/foreach}>
                                            </select>

                                            <select name="cityid" id="cityid"  class="msg_text"  style="margin-right: 5px;">
                                                <option value="">请选择</option>
                                                <{if  !empty($consignee.cityid)}>
                                                <option value="<{$consignee.cityid}>" selected><{$consignee.cityid|get_city_name}></option>
                                                <{/if}>
                                            </select>

                                            <select name="areaid" id="areaid"  class="msg_text">
                                                <option value="">请选择</option>
                                                <{if  !empty($consignee.areaid)}>
                                                <option value="<{$consignee.areaid}>" selected><{$consignee.areaid|get_city_name}></option>
                                                <{/if}>
                                            </select>
                                        </dd>
                                    </dl>

                                    <dl>
                                        <dt>街道地址：</dt>
                                        <dd><textarea class="msg_area" name="user_addr" id="user_addr" cols="" rows=""></textarea><span>（*此处可输入详细信息，具体到门牌号)</span></dd>
                                    </dl>
                                </div>
                            </div>

                            <!--预定按钮-->
                            <div class="tj_btn_order">
                                <a href="javascript:;" class="btnsaveorder">提交信息</a>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <script type="text/javascript">

            $("#provinceid").on('change',function(){
                var provinceid = $(this).val();
                $.post("<{$config.weburl}>/ajax.php",{action:'get_city',id:provinceid},function(ret){
                     ret = eval('('+ret+')');
                     $("#cityid").html(ret.content);
                });
            });
            $("#cityid").on('change',function(){
                var cityid = $(this).val();
                $.post("<{$config.weburl}>/ajax.php",{action:'get_city',id:cityid},function(ret){
                     ret = eval('('+ret+')');
                     $("#areaid").html(ret.content);
                });
            });

            function check_data(){
                var price = $("#price").val();
                var user_name = $("#user_name").val();
                var user_mobile = $("#user_mobile").val();
                var cityid = $("#cityid").val();
                var areaid = $("#areaid").val();
                var user_addr = $("#user_addr").val();
                var preg_mobile = /^1\d{10}$/;

                if(price == ''){
                    alert("价格不能为空");
                    return false;
                } else if(user_name == '') {
                    alert("请填写联系人");
                    return false;
                } else if(user_mobile == '') {
                    alert("请填写联系手机");
                    return false;
                }  else if(!preg_mobile.test(user_mobile)) {
                    alert("请填正确的手机号");
                    return false;
                } else if(provinceid == '') {
                    alert("请选择省");
                    return false;
                } else if(cityid == '') {
                    alert("请选择市");
                    return false;
                } else if(areaid == '') {
                    alert("请选择区");
                    return false;
                } else if(user_addr == '') {
                    alert("请填写街道地址");
                    return false;
                } else {
                    return true;
                }

            }


            $(".btnsaveorder").on('click',function(){
                $("#order_form").submit();
            });
        </script>
<{include file="footer.htm"}>

